<?php //debug($member);   ?>
<div id="profile_view col-lg-12">

    <section class="row-fluid text-xs">
        <div class="panel col-lg-7">
            <header class="panel-heading">
                <h5 class="h5">Basic Information</h5>
            </header>

            <div class="panel-body">
                <table class="table table-condensed details_table">
                    <tr>
                        <th>Name:</th>
                        <td style='text-transform: capitalize;'><?php echo $member['Member']['last_name'] . ' ' . $member['Member']['first_name']; ?> (<?php echo $member['Member']['title']; ?>)</td>
                    </tr>

                    <tr>
                        <th>Birth Date:</th>
                        <td><?php echo date('d F Y', strtotime($member['Member']['dob'])); ?></td>
                    </tr>
                    <!--<tr>
                        <th>Gender:</th>
                        <td><?php echo $member['Member']['gender']; ?></td>
                    </tr>-->
                    <tr>
                        <th>Marital Status:</th>
                        <td style='text-transform: capitalize;'><?php echo $member['Member']['marital_status']; ?></td>
                    </tr>
                    <tr>
                        <th>Place of Birth:</th>
                        <td><?php echo $member['Member']['place_of_birth']; ?></td>
                    </tr>

                    <tr>
                        <th>Hometown:</th>
                        <td><?php echo $member['Member']['home_town']; ?></td>
                    </tr>

                    <tr>
                        <th>Nationality:</th>
                        <td><?php echo $member['Member']['nationality']; ?></td>
                    </tr>

                    <tr>
                        <th>Educational Background:</th>
                        <td><?php echo $member['Member']['educational_bg']; ?></td>
                    </tr>

                    <tr>
                        <th>Field of study:</th>
                        <td><?php echo $member['Member']['field_of_study']; ?></td>
                    </tr>

                    <tr>
                        <th>Tribe: </th>
                        <td><?php echo $member['Member']['tribe']; ?></td>

                    </tr>
                    <tr>
                        <th>Profession: </th>
                        <td><?php echo $member['Member']['profession']; ?></td>
                    </tr>
                    <tr>
                        <th>Occupation:</th>
                        <td><?php echo $member['Member']['occupation']; ?></td>

                    </tr>
                    <tr>
                        <th>Position: </th>
                        <td><?php echo $member['Member']['position']; ?></td>
                    </tr>
                </table>
            </div>
        </div>
        
        <div class="panel col-lg-5">
            <header class="panel-heading">
                <h5 class="h5">Profile Picture</h5>
            </header>

            <div class="panel-body">
                <?php
                if (isset($member['OrganisationMemberImage']['MemberImage']['id']) && $member['OrganisationMemberImage']['MemberImage']['id'] != null) {
                    $src = $this->Html->url($member['OrganisationMemberImage']['MemberImage']['file_path']);
                }
                ?>

                <div id="image-box" class="image-box" style="width: 82%; height: 98%; border: solid 1px #ddd; margin: 0px auto; background-position: center;
                     background-size: cover; <?php echo isset($src) ? "background-image: url($src);" : ''; ?>">
                </div>

                <div style="margin-top: 10px; text-align: center;">
                    <span class="btn btn-sm btn-default fileinput-button single-file-upload-manager"
                          data-url='<?php echo $this->Html->url(array('controller' => 'Images', 'action' => 'upload_image_and_tag')); ?>'
                          data-save_to='img/org_<?php //echo $org_id; ?>'
                          data-max-filesize='2000000'
                          data-filetypes='/(\.|\/)(gif|jpe?g|png)$/i'
                          data-image_max_width = '300'
                          data-image_max_height='300'
                          data-number_upload_files= 1
                          data-extra_params_callback='member_view.image_upload_extra_param_callback'
                          data-callback='member_view.image_upload_callback'
                          >
                        <i class="fa fa-upload"></i>
                        <span>Select image...</span>
                        <input id="fileupload" type="file" name="files[]" multiple="" style="position: absolute; visibility: hidden;">
                    </span>
                    <div id="single-upload-progress" class="progress hide" style="height: 7px; margin: 10px 0px;">
                        <div class="progress-bar progress-bar-success"></div>
                    </div>
                </div>
            </div>
        </div>

        <div class="panel col-lg-7">
            <header class="panel-heading">
                <h5 class="h5">Contact Information<h5>
            </header>

            <div class="panel-body">
                <table class="table table-condensed details_table">
                    <tr>
                        <th width="40%" nowrap>Mobile Number:</th>
                        <td><?php echo $member['Member']['mobile_number']; ?></td>
                    </tr>

                    <tr>
                        <th>Office Number:</th>
                        <td><?php echo $member['Member']['office_number']; ?></td>
                    </tr>

                    <tr>
                        <th>Postal Address: </th>
                        <td><?php echo $member['Member']['address']; ?></td>
                    </tr>
                    <tr>
                        <th>Email Address: </th>
                        <td><a class="text-info" href="mailto:<?php echo $member['Member']['email']; ?>" target="_blank"><?php echo $member['Member']['email']; ?></a></td>
                    </tr>

                    <tr>
                        <th>Website: </th>
                        <td><a class="text-info" href="<?php echo $member['Member']['website']; ?>" target="_blank"><?php echo $member['Member']['website']; ?></a></td>
                    </tr>

<!--<tr>
    <td>Social Profiles:</td>
    <td colcol-lg-="3">
        <label class="label label-info" style="display: inline">Facebook</label>
        <label class="label label-info" style="display: inline">Twitter</label>
    </td>
</tr>-->

                </table>

                <table class="table table-condensed details_table">
                    <tr>
                        <th>Business Address:</th>
                        <td>
                            <?php echo $member['Member']['business_address'] . ", "; ?> 
                            <?php echo $member['Member']['business_city']; ?> <?php echo $member['Member']['business_region']; ?>
                            <?php echo $member['Member']['business_zip_code']; ?>
                        </td>
                    </tr>
                    <tr>
                        <th>Residential Address:</th>
                        <td>
                            <?php echo $member['Member']['residential_address'] . ", "; ?> 
                            <?php echo $member['Member']['residential_region']; ?> <?php echo $member['Member']['residential_city']; ?>
                            <?php echo $member['Member']['residential_zip_code']; ?>
                        </td>
                    </tr>
                </table>

                <table class="table table-condensed details_table">
                    <tr>
                        <th width="40%" nowrap>Organisation No#:</th>
                        <td>
                            <?php //echo $member['OrganisationMember']['organisation_no']; ?>
                        </td>
                    </tr>
                </table>
            </div>
        </div>

        
    </section>

    <section>
        <?php if (isset($org_settings['family_information']) && $org_settings['family_information']) { ?>
            <div class="col-lg-4">
                <header>
                    <h5 class="pull-left">Family</h5>

                        <!--<a href="#" class="pull-right edit-btn btn btn-mini"><i class="icon icon-pencil"></i> Edit</a>-->
                </header>

                <table class="table table-condensed details_table">
                    <tr>
                        <td width="25%">Father:</td>
                        <td>
                            <?php echo isset($member['Member']['MemberParent'][0]) ? $member['Member']['MemberParent'][0]['name'] : 'N/A'; ?>
                        </td>
                    </tr>

                    <tr>
                        <td width="25%">Mother:</td>
                        <td>
                            <?php echo isset($member['Member']['MemberParent'][1]) ? $member['Member']['MemberParent'][1]['name'] : 'N/A'; ?>
                        </td>
                    </tr>
                    <tr>
                        <td width="25%">Spouse:</td>
                        <td>
                            <?php echo isset($member['Member']['MemberSpouse'][0]) ? $member['Member']['MemberSpouse'][0]['name'] : 'N/A'; ?>
                        </td>
                    </tr>

                    <?php
                    $positions = array('1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th', '9th', '10th');
                    foreach ($member['Member']['MemberChild'] as $i => $child) {
                        ?>
                        <tr>
                            <?php if ($i == 0) { ?>
                                <td>Children:</td>
                            <?php } else { ?>
                                <td>&nbsp;</td>
                            <?php } ?>
                            <td>
                                <?php echo $child['name']; ?>
                            </td>
                        </tr>
                    <?php } ?>
                </table>
            </div>
        <?php } ?>

        <div class="panel col-lg-5">
            <header class="panel-heading">
                <h5 class="h5">Groups And Associations</h5>
            </header>

            <div class="panel-body">
            <table class="table table-condensed details_table">
                <?php
//                if ($member['OrganisationMemberGroup']) {
//                    foreach ($org_info['OrganisationGroupType'] as $group) {
//                        ?>
<!--                        <tr>
                            <th width='30%'><?php //echo $group['name']; ?>:</th>
                            <td>
                                <?php
//                                $name = 'N/A';
//                                foreach ($member['OrganisationMemberGroup'] as $mg) {
//                                    if ($mg['OrganisationGroup'] && $mg['OrganisationGroup']['organisation_group_type_id'] == $group['id']) {
//                                        $name = $mg['OrganisationGroup']['name'];
//                                        break;
//                                    }
//                                }
//
//                                echo $name;
//                                ?>
                            </td>
                        </tr>-->
                        <?php
//                    }
//                } else {
                    ?>

                    <tr>
                        <th>Member Is Not Associated With Any Groups</th>
                    </tr>
                <?php // } ?>
            </table>
            </div>
        </div>

        <div class="panel col-lg-5">
            <header class="panel-heading">
                <h5 class="h5">Important Dates</h5>
            </header>

            <div class="panel-body">
            <table class="table table-condensed details_table">

                <?php
//                if ($member['OrganisationMemberAnniversary']) {
//                    foreach ($org_info['OrganisationAnniversary'] as $date) {
//                        ?>
<!--                        <tr>
                            <th width='40%'><?php //echo $date['name']; ?>:</th>
                            <td>
                                <?php
//                                $date_value = "N/A";
//                                foreach ($member['OrganisationMemberAnniversary'] as $md) {
//                                    if ($md['organisation_anniversary_id'] == $date['id'] && $md['value'] != '') {
//                                        $date_value = date('jS M, Y', strtotime($md['value']));
//                                        break;
//                                    }
//                                }
//
//                                echo $date_value;
//                                ?>
                            </td>
                        </tr>-->
                        <?php
//                    }
//                } else {
                    ?>

                    <tr>
                        <th>Member Has No Important Dates Recorded</th>
                    </tr>
                <?php // } ?>
            </table>
            </div>
        </div>


    </section>



</div>
<?php echo $this->element('single_file_upload_manager'); ?>